<template>
	<!-- #ifndef MP-ALIPAY || MP-TOUTIAO -->
		<custom-nav :showBackArrow="true"></custom-nav>
	<!-- #endif -->
	<view class="page-share">
		<button type="default" open-type="share" :plain="true" class="share-btn"></button>
		<image class="share-poster" src="../../static/share.png" mode="widthFix">
		</image>
	</view>
</template>

<script setup>
	import {
		onShareAppMessage,
	} from '@dcloudio/uni-app';
	import customNav from '@/components/custom-nav/index.vue';
	import {
		ref
	} from "vue";
	// const shareImageUrl = ref('/static/other/share-poster.png');
	// 监听分享
	onShareAppMessage(function(res) {
		const userInfoData = uni.getStorageSync('userInfo');
		return {
			path: '/pages/index/index?id=' + userInfoData.id,
			imageUrl: '../../static/shareImg.png',
		}
	})
	// const downLoadShareImage = () => {
	// 	uni.downloadFile({
	// 		url: 'https://sspzjz.oss-cn-shanghai.aliyuncs.com/photo/share/share2.png',
	// 		header: {
	// 			Authorization: 'Bearer ' + uni.getStorageSync('Authorization_token'),
	// 		},
	// 		success(res) {
	// 			shareImageUrl.value = res.tempFilePath;
	// 			console.log('shareImageUrl', shareImageUrl.value)
	// 		},
	// 	})
	// }
	// downLoadShareImage();
</script>

<style lang="scss" scoped>
	.page-share {
		line-height: 0;
		position: relative;

		.share-poster {
			height: 1624rpx;
			width: 100%;
		}

		.share-btn {
			box-sizing: border-box;
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			opacity: 0;
			z-index: 2;
		}
	}
</style>